<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>DL Classification [HALCON算子参考手册]</title>
<style type="text/css">
      body {
    color: #000000;
    background-color: #ffffff;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
}

.body_main {
    margin-left: 35px;
    margin-right: 35px;
}

@media screen and (min-width:992px) {

    .body_main {
        margin-left: 10%;
        margin-right: 10%;
    }

    table.toctable {
        width: 80%
    }
}

@media screen and (min-width:1400px) {

    .body_main {
        margin-left: 15%;
        margin-right: 15%;
    }

    table.toctable {
        width: 70%
    }
}

body>div ul ul {
    margin-left: inherit;
}

a:link {
    color: #0044cc;
}

a:link,
a:visited {
    text-decoration: none;
}

a:link:hover,
a:visited:hover {
    text-decoration: underline;
}

th {
    text-align: left;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    text-rendering: optimizeLegibility;
    color: #666666;
}

code {
    font-family: monospace,monospace;
}

h1 a.halconoperator {
    font-family: Arial, Helvetica, sans-serif;
    color: #666666;
}

h2 a.halconoperator {
    font-family: Arial, Helvetica, sans-serif;
    color: #666666;
}

hr {
    border: 0;
    border-top: solid 1px #f28d26;
}

.pre {
    display: block;
    padding-bottom: 1ex;
    font-family: monospace;
    white-space: pre;
}

pre {
    font-family: monospace, monospace;
    padding: 1ex;
    white-space: pre-wrap;
}

.toc {
    font-size: 80%;
    border-top: 1px dashed #f28d26;
    border-bottom: 1px dashed #f28d26;
    padding-top: 5px;
    padding-bottom: 5px;
}

.inv {
    margin: 0;
    border: 0;
    padding: 0;
}

.banner {
    color: #666666;
    padding-left: 1em;
}

.logo {
    background-color: white;
}

.keyboard {
    font-size: 80%;
    padding-left: 3px;
    padding-right: 3px;
    border-radius: 5px;
    border-width: 1px;
    border-style: solid;
    border-color: #f28d26;
    background-color: #f3f3f3;
}

.warning {
    margin-top: 2ex;
    margin-bottom: 1ex;
    padding: 10px;
    text-align: center;
    border: 1px solid;
    color: #bb0000;
    background-color: #fff7f7
}

.imprint {
    margin-top: 1ex;
    font-size: 80%;
    color: #666666;
}

.imprinthead {
    font-weight: bolder;
    color: #666666;
}

.indexlink {
    text-align: right;
    padding-bottom: 5px;
}

.postscript {
    margin-top: 2ex;
    font-size: 80%;
    color: #666666
}

.evenrow {
    background-color: #e7e7ef;
    vertical-align: top;
}

.oddrow {
    background-color: #f7f7ff;
    vertical-align: top;
}

.headrow {
    background-color: #97979f;
    color: #ffffff;
    vertical-align: top;
}

.logorow {
    vertical-align: top;
}

.error {
    color: red;
}

.var {
    font-style: italic
}

.halconoperator {
    font-family: monospace, monospace;
}

span.operator {
    font-family: monospace, monospace;
}

span.procedure {
    font-family: monospace, monospace;
}

span.operation {
    font-family: monospace, monospace;
}

span.feature {
    font-family: Arial, Helvetica, Homerton, sans-serif;
}

ul {
    padding-left: 1.2em;
}

li.dot {
    list-style-type: square;
    color: #f28d26;
}

.breadcrumb {
    font-size: 80%;
    color: white;
    background-color: #062d64;
    margin-bottom: 20px;
    padding-left: 35px;
    padding-right: 35px;
    padding-bottom: 15px;
}

.webbar {
    font-size: 80%;
    background-color: #dddddd;
    margin-top: 0px;
    margin-left: -35px;
    margin-right: -35px;
    margin-bottom: 0px;
    padding-top: 5px;
    padding-left: 35px;
    padding-right: 35px;
    padding-bottom: 5px;
}

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    border-top: 1px dashed #f28d26;
    font-size: 80%;
    color: #666666;
    padding-bottom: 8px;
}

.footer .socialmedia a {
    padding-left: 7px;
}

.socialmedia {
    padding-top: 10px;
}

.copyright {
    margin-top: 19px;
}

.breadcrumb a {
    color: #ffffff;
    border-bottom: 1px solid white;
}

.breadcrumb a:link:hover,
.breadcrumb a:visited:hover {
    text-decoration: none;
    border-bottom: none;
}

.heading {
    margin-top: 1ex;
    font-size: 110%;
    font-weight: bold;
    color: #666666;
}

.text {
    color: black;
}

.example {
    font-size: 80%;
    background-color: #f3f3f3;
    border: 1px dashed #666666;
    padding: 10px;
}

.displaymath {
    display: block;
    text-align: center;
    margin-top: 1ex;
    margin-bottom: 1ex;
}

.title {
    float: left;
    padding-top: 3px;
    padding-bottom: 3px;
}

.signnote {
    font-family: Arial, Helvetica, Homerton, sans-serif;
    font-size: 80%;
    color: #666666;
    font-weight: lighter;
    font-style: italic
}

.par {
    margin-bottom: 1.5em;
}

.parhead {
    text-align: right;
}

.parname {
    float: left;
}

.pardesc {
    font-size: 85%;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    margin-left: 2em;
}

.parcat {
    color: #666;
    font-weight: bold;
}

*[data-if=cpp],
*[data-if=c],
*[data-if=dotnet],
*[data-if=com],
*[data-if=python] {
    display: none;
}

.tabbar {
    text-align: right;
    border-bottom: 1px solid #f28d26;
    margin-bottom: 0.5em;
}

ul.tabs {
    padding-top: 3px;
    padding-bottom: 3px;
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 80%
}

ul.tabs li {
    padding-top: 3px;
    padding-bottom: 3px;
    display: inline;
    overflow: hidden;
    list-style-type: none;
    margin: 0;
    margin-left: 8px;
    border-top: 1px solid #666;
    border-left: 1px solid #666;
    border-right: 1px solid #666;
}

ul.tabs li.active {
    border-left: 1px solid #f28d26;
    border-right: 1px solid #f28d26;
    border-top: 1px solid #f28d26;
    border-bottom: 1px solid #fff;
}

ul.tabs li.inactive {
    background-color: #eee;
}

ul.tabs li a {
    padding-left: 5px;
    padding-right: 5px;
    color: #666;
}

ul.tabs li a:link:hover {
    text-decoration: none;
}

ul.tabs li.inactive a {
    color: #666;
}

ul.tabs li.active a {
    color: black;
}

dl.generic dd {
    margin-bottom: 1em;
}

.pari {
    color: olive;
}

.paro {
    color: maroon;
}

.comment {
    font-size: 80%;
    color: green;
    white-space: nowrap;
}

table.grid {
    border-collapse: collapse;
}

table.grid td {
    padding: 5px;
    border: 1px solid;
}

table.layout {
    border: 0px;
}

table.layout td {
    padding: 5px;
}

table.table {
    border-collapse: collapse;
}

table.table td {
    padding: 5px;
    border-left: 0px;
    border-right: 0px;
}

table.table tr:last-child {
    border-bottom: 1px solid;
}

table.table th {
    padding: 5px;
    border-top: 1px solid;
    border-bottom: 1px solid;
    border-left: 0px;
    border-right: 0px;
}

.details_summary {
    cursor: pointer;
}

table.toctable {
    width: 100%;
}

table.toctable col:first-child {
    width: 20%;
}

table.toctable col:nth-last-child(2) {
    width: 8%;
}

table.altcolored tr:nth-child(even) {
    background-color: #f3f3f3;
}

    </style>
<!--OP_REF_STYLE_END-->
<script>
    <!--
var active_lang='hdevelop';function switchVisibility(obj,active_lang,new_lang)
{var display_style='inline';
for(var i=0;i<obj.length;i++)
{if(obj.item(i).getAttribute('data-if')==new_lang)
{obj.item(i).style.display=display_style;}
if(obj.item(i).getAttribute('data-if')==active_lang)
{obj.item(i).style.display='none';}}
return;}
function toggleLanguage(new_lang,initial)
{if(active_lang!=new_lang)
{var lis=document.getElementsByTagName('li');for(var i=0;i<lis.length;i++)
{if(lis.item(i).id=='syn-'+new_lang)
{lis.item(i).className='active';}
else
{lis.item(i).className='inactive';}}
var divs=document.getElementsByTagName('div');var spans=document.getElementsByTagName('span');switchVisibility(divs,active_lang,new_lang);switchVisibility(spans,active_lang,new_lang);if(!initial)
{setCookie("halcon_reference_language",new_lang,null,null);}
active_lang=new_lang;}
return;}
function setCookie(name,value,domain,exp_offset,path,secure)
{localStorage.setItem(name,value);}
function getCookie(name)
{return localStorage.getItem(name);}
function initialize()
{var qs=location.href.split('?')[1];var qs_lang_raw=location.href.split('interface=')[1];var qs_lang;if(qs_lang_raw)
{qs_lang=qs_lang_raw.split('#')[0];}
var cookie_lang=getCookie("halcon_reference_language");var new_lang;if((qs_lang=="hdevelop")||(qs_lang=="dotnet")||(qs_lang=="python")||(qs_lang=="cpp")||(qs_lang=="c"))
{new_lang=qs_lang;setCookie("halcon_reference_language",new_lang,null,null);}
else if((cookie_lang=="hdevelop")||(cookie_lang=="dotnet")||(cookie_lang=="python")||(cookie_lang=="cpp")||(cookie_lang=="c"))
{new_lang=cookie_lang;}
else
{new_lang="hdevelop";}
toggleLanguage(new_lang,1);return;}
-->

  </script>
</head>
<body onLoad="initialize();">
<div class="breadcrumb">
<br class="inv"><a href="index.html">目录</a> / <a href="toc_legacy.html">过时</a><br class="inv">
</div>
<div class="body_main">
<div class="tabbar"><ul class="tabs">
<li id="syn-hdevelop" class="active"><a href="javascript:void(0);" onclick="toggleLanguage('hdevelop')" onfocus="blur()">HDevelop</a></li>
<li id="syn-dotnet" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('dotnet')" onfocus="blur()">.NET</a></li>
<li id="syn-python" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('python')" onfocus="blur()">Python</a></li>
<li id="syn-cpp" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('cpp')" onfocus="blur()">C++</a></li>
<li id="syn-c" class="inactive"><a href="javascript:void(0);" onclick="toggleLanguage('c')" onfocus="blur()">C</a></li>
</ul></div>
<div class="indexlink">
<a href="index_classes.html"><span data-if="dotnet" style="display:none;">类别</span><span data-if="cpp" style="display:none;">类别</span></a><span data-if="dotnet" style="display:none;"> | </span><span data-if="cpp" style="display:none;"> | </span><a href="index_by_name.html">算子列表</a>
</div>
<h2>DL Classification</h2>
<p><a href="#section_list">List of Operators ↓</a></p>
<p><b>The workflow and operators described in this chapter
are obsolete and only provided for reasons backward compatibility.</b>
New applications should use the workflow and operators described in
<a href="toc_deeplearning_classification.html">Deep Learning / Classification</a>.
</p>
<p>This chapter explains how to use classification based on deep learning,
both for the training and inference phases.
</p>
<h3>General Workflow</h3>
<p>This section describes the main steps and the workflow for classification
with Deep Learning using the obsolete workflow.
</p>
<dl class="generic">


<dt><b>Prepare the Network and the Data</b></dt>
<dd>
<p>

This part is about how to prepare and preprocess your data.
</p>
<ol>
<li>
<p> First, a pretrained network has to be read using 该算子
</p>
<ul>
<li>
<p> <a href="read_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline"><code>read_dl_classifier</code></span><span data-if="c" style="display:none"><code>read_dl_classifier</code></span><span data-if="cpp" style="display:none"><code>ReadDlClassifier</code></span><span data-if="com" style="display:none"><code>ReadDlClassifier</code></span><span data-if="dotnet" style="display:none"><code>ReadDlClassifier</code></span><span data-if="python" style="display:none"><code>read_dl_classifier</code></span></code></a>.
</p>
</li>
</ul>
<p>
This operator is used as well when you want to read your own trained
networks, after you saved them with <a href="write_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline"><code>write_dl_classifier</code></span><span data-if="c" style="display:none"><code>write_dl_classifier</code></span><span data-if="cpp" style="display:none"><code>WriteDlClassifier</code></span><span data-if="com" style="display:none"><code>WriteDlClassifier</code></span><span data-if="dotnet" style="display:none"><code>WriteDlClassifier</code></span><span data-if="python" style="display:none"><code>write_dl_classifier</code></span></code></a>.
</p>
</li>
<li>
<p> To read the data for your deep learning classification training
the procedure
</p>
<ul>
<li>
<p> <code>read_dl_classifier_data_set</code>
</p>
</li>
</ul>
<p>
is available. Using this procedure you can get a list of image file
paths and their respective labels (the ground truth labels)
as well as a list of the unique classes, to which at least one of the
listed images belongs.
</p>
</li>
<li>
<p> The network will impose several requirements on the images,
as the image dimensions and the gray value range.
The default values are listed in <a href="read_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline"><code>read_dl_classifier</code></span><span data-if="c" style="display:none"><code>read_dl_classifier</code></span><span data-if="cpp" style="display:none"><code>ReadDlClassifier</code></span><span data-if="com" style="display:none"><code>ReadDlClassifier</code></span><span data-if="dotnet" style="display:none"><code>ReadDlClassifier</code></span><span data-if="python" style="display:none"><code>read_dl_classifier</code></span></code></a>. These are
the values with which the networks have been pretrained.
The network architectures allow different image dimensions, which can
be set with <a href="set_dl_classifier_param.html"><code><span data-if="hdevelop" style="display:inline"><code>set_dl_classifier_param</code></span><span data-if="c" style="display:none"><code>set_dl_classifier_param</code></span><span data-if="cpp" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="com" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="dotnet" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="python" style="display:none"><code>set_dl_classifier_param</code></span></code></a>, but depending on the
network a change may make a retraining necessary.
The actually set values can be retrieved with
</p>
<ul>
<li>
<p> <a href="get_dl_classifier_param.html"><code><span data-if="hdevelop" style="display:inline"><code>get_dl_classifier_param</code></span><span data-if="c" style="display:none"><code>get_dl_classifier_param</code></span><span data-if="cpp" style="display:none"><code>GetDlClassifierParam</code></span><span data-if="com" style="display:none"><code>GetDlClassifierParam</code></span><span data-if="dotnet" style="display:none"><code>GetDlClassifierParam</code></span><span data-if="python" style="display:none"><code>get_dl_classifier_param</code></span></code></a>.
</p>
</li>
</ul>

<p>The procedure <code>preprocess_dl_classifier_images</code> provides great
guidance on how to implement such a preprocessing stage.
We recommend to preprocess and store all images used for the training
before starting the classifier training, since this speeds up the
training significantly.
</p>
</li>
<li>
<p> Next, we recommend to split the dataset into three distinct
datasets which are used for training, validation, and testing, see
the section “Data” in the chapter <a href="toc_deeplearning.html">Deep Learning</a>.
This can be achieved using the procedure
</p>
<ul>
<li>
<p> <code>split_dl_classifier_data_set</code>.
</p>
</li>
</ul>

</li>
<li>
<p> You need to specify the <i><span data-if="hdevelop" style="display:inline"><code>'classes'</code></span><span data-if="c" style="display:none"><code>"classes"</code></span><span data-if="cpp" style="display:none"><code>"classes"</code></span><span data-if="com" style="display:none"><code>"classes"</code></span><span data-if="dotnet" style="display:none"><code>"classes"</code></span><span data-if="python" style="display:none"><code>"classes"</code></span></i> (determined before by
use of <code>read_dl_classifier_data_set</code>) you want to differentiate
with your classifier. For this, 该算子
</p>
<ul>
<li>
<p> <a href="set_dl_classifier_param.html"><code><span data-if="hdevelop" style="display:inline"><code>set_dl_classifier_param</code></span><span data-if="c" style="display:none"><code>set_dl_classifier_param</code></span><span data-if="cpp" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="com" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="dotnet" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="python" style="display:none"><code>set_dl_classifier_param</code></span></code></a>
</p>
</li>
</ul>
<p>
is available.
</p>
<p>This operator can also be used to set hyperparameters, which are
important for training, e.g., <i><span data-if="hdevelop" style="display:inline"><code>'batch_size'</code></span><span data-if="c" style="display:none"><code>"batch_size"</code></span><span data-if="cpp" style="display:none"><code>"batch_size"</code></span><span data-if="com" style="display:none"><code>"batch_size"</code></span><span data-if="dotnet" style="display:none"><code>"batch_size"</code></span><span data-if="python" style="display:none"><code>"batch_size"</code></span></i> and
<i><span data-if="hdevelop" style="display:inline"><code>'learning_rate'</code></span><span data-if="c" style="display:none"><code>"learning_rate"</code></span><span data-if="cpp" style="display:none"><code>"learning_rate"</code></span><span data-if="com" style="display:none"><code>"learning_rate"</code></span><span data-if="dotnet" style="display:none"><code>"learning_rate"</code></span><span data-if="python" style="display:none"><code>"learning_rate"</code></span></i>.
For a more detailed explanation, see the chapter
<a href="toc_deeplearning.html">Deep Learning</a> and the documentation of
<a href="set_dl_classifier_param.html"><code><span data-if="hdevelop" style="display:inline"><code>set_dl_classifier_param</code></span><span data-if="c" style="display:none"><code>set_dl_classifier_param</code></span><span data-if="cpp" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="com" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="dotnet" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="python" style="display:none"><code>set_dl_classifier_param</code></span></code></a>.
</p>
</li>
</ol>

</dd>

<dt><b>Train the Network and Evaluate the Training Progress</b></dt>
<dd>
<p>

Once your network is set up and your data prepared it is time to train
the classifier for your specific task.
</p>
<ol>
<li>
<p> Set the hyperparameters used for training with 该算子
</p>
<ul>
<li>
<p> <a href="set_dl_classifier_param.html"><code><span data-if="hdevelop" style="display:inline"><code>set_dl_classifier_param</code></span><span data-if="c" style="display:none"><code>set_dl_classifier_param</code></span><span data-if="cpp" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="com" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="dotnet" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="python" style="display:none"><code>set_dl_classifier_param</code></span></code></a>.
</p>
</li>
</ul>
<p>
For an overview of possible hyperparameters, see the documentation of
<a href="set_dl_classifier_param.html"><code><span data-if="hdevelop" style="display:inline"><code>set_dl_classifier_param</code></span><span data-if="c" style="display:none"><code>set_dl_classifier_param</code></span><span data-if="cpp" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="com" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="dotnet" style="display:none"><code>SetDlClassifierParam</code></span><span data-if="python" style="display:none"><code>set_dl_classifier_param</code></span></code></a>. Additional explanations can be found
in the chapter <a href="toc_deeplearning.html">Deep Learning</a>.
</p>
</li>
<li>
<p> To train the classifier 该算子
</p>
<ul>
<li>
<p> <a href="train_dl_classifier_batch.html"><code><span data-if="hdevelop" style="display:inline"><code>train_dl_classifier_batch</code></span><span data-if="c" style="display:none"><code>train_dl_classifier_batch</code></span><span data-if="cpp" style="display:none"><code>TrainDlClassifierBatch</code></span><span data-if="com" style="display:none"><code>TrainDlClassifierBatch</code></span><span data-if="dotnet" style="display:none"><code>TrainDlClassifierBatch</code></span><span data-if="python" style="display:none"><code>train_dl_classifier_batch</code></span></code></a>
</p>
</li>
</ul>
<p>
is available.
The intermediate training results are stored in the output handle.
</p>
<p>As the name of <a href="train_dl_classifier_batch.html"><code><span data-if="hdevelop" style="display:inline"><code>train_dl_classifier_batch</code></span><span data-if="c" style="display:none"><code>train_dl_classifier_batch</code></span><span data-if="cpp" style="display:none"><code>TrainDlClassifierBatch</code></span><span data-if="com" style="display:none"><code>TrainDlClassifierBatch</code></span><span data-if="dotnet" style="display:none"><code>TrainDlClassifierBatch</code></span><span data-if="python" style="display:none"><code>train_dl_classifier_batch</code></span></code></a> indicates, this
operator processes a batch of data (images and ground truth labels) at
once.
We iterate through our training data in order to train
the classifier successively with <a href="train_dl_classifier_batch.html"><code><span data-if="hdevelop" style="display:inline"><code>train_dl_classifier_batch</code></span><span data-if="c" style="display:none"><code>train_dl_classifier_batch</code></span><span data-if="cpp" style="display:none"><code>TrainDlClassifierBatch</code></span><span data-if="com" style="display:none"><code>TrainDlClassifierBatch</code></span><span data-if="dotnet" style="display:none"><code>TrainDlClassifierBatch</code></span><span data-if="python" style="display:none"><code>train_dl_classifier_batch</code></span></code></a>.
You can repeat this process multiple times and iterate over so many
training epochs until you are satisfied with the training result.
</p>
</li>
<li>
<p> To know how well the classifier learns the new task, the procedure
</p>
<ul>
<li>
<p> <code>plot_dl_classifier_training_progress</code>
</p>
</li>
</ul>
<p>
is provided. With it you can plot the classification errors
during training. To compute the input necessary for the visualization,
the procedures
</p>
<ul>
<li>
<p> <code>select_percentage_dl_classifier_data</code>,
</p>
</li>
<li>
<p> <code>apply_dl_classifier_batchwise</code>, and
</p>
</li>
<li>
<p> <code>evaluate_dl_classifier</code>
</p>
</li>
</ul>
<p>
are available. With them you can reduce the number of images used
for this classification validation, apply the classifier on the
selected data and compute, for example, the top-1 error.
</p>
</li>
</ol>

</dd>

<dt><b>Apply and Evaluate the Final Classifier</b></dt>
<dd>
<p>

Your classifier is trained for your task and ready to be applied. But
before deploying in the real world you should evaluate how well the
classifier performs on basis of your test data.
</p>
<ol>
<li>
<p> To apply the classifier on a set containing an arbitrary number
of images, use 该算子
</p>
<ul>
<li>
<p> <a href="apply_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline"><code>apply_dl_classifier</code></span><span data-if="c" style="display:none"><code>apply_dl_classifier</code></span><span data-if="cpp" style="display:none"><code>ApplyDlClassifier</code></span><span data-if="com" style="display:none"><code>ApplyDlClassifier</code></span><span data-if="dotnet" style="display:none"><code>ApplyDlClassifier</code></span><span data-if="python" style="display:none"><code>apply_dl_classifier</code></span></code></a>.
</p>
</li>
</ul>
<p>
The runtime of this operator depends on the number of batches needed for
the given image set.
</p>
<p>The results are returned in a handle.
</p>
<p>To retrieve the predicted classes and confidences, use 该算子
</p>
<ul>
<li>
<p> <a href="get_dl_classifier_result.html"><code><span data-if="hdevelop" style="display:inline"><code>get_dl_classifier_result</code></span><span data-if="c" style="display:none"><code>get_dl_classifier_result</code></span><span data-if="cpp" style="display:none"><code>GetDlClassifierResult</code></span><span data-if="com" style="display:none"><code>GetDlClassifierResult</code></span><span data-if="dotnet" style="display:none"><code>GetDlClassifierResult</code></span><span data-if="python" style="display:none"><code>get_dl_classifier_result</code></span></code></a>.
</p>
</li>
</ul>

</li>
<li>
<p> Now it is time to evaluate these results. The performance of the
classifier can be evaluated as during the training with
<code>evaluate_dl_classifier</code>.
</p>
<p>To visualize and analyze the classifier quality, the confusion matrix is
a useful tool (see below for an explanation).
For this, you can use the procedures
</p>
<ul>
<li>
<p> <code>gen_confusion_matrix</code>
</p>
</li>
<li>
<p> <code>gen_interactive_confusion_matrix</code>.
</p>
</li>
</ul>
<p>
The interactive procedure gives you the possibility to select examples
of a specific category, but it does not work with exported code.
</p>
<p>Additionally, after applying the classifier on a set of data, you can
use the procedure
</p>
<ul>
<li>
<p> <code>get_dl_classifier_image_results</code>
</p>
</li>
</ul>
<p>
to display and return images according to certain criteria, e.g.,
wrongly classified ones.
Then, you might want to use this input for the procedure
</p>
<ul>
<li>
<p> <code>dev_display_dl_classifier_heatmap</code>,
</p>
</li>
</ul>
<p>
to display a heatmap of the input image, with which you can analyze
which regions of the image are relevant for the classification
result.
</p>
</li>
</ol>

</dd>

<dt><b>Inference Phase</b></dt>
<dd>
<p>

When your classifier is trained and you are satisfied with its
performance, you can use it to classify new images. For this,
you simply preprocess your images according to the network requirements
(i.e., the same way as you did for your dataset used for training the
classifier) and apply the classifier using
</p>
<ul>
<li>
<p> <a href="apply_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline"><code>apply_dl_classifier</code></span><span data-if="c" style="display:none"><code>apply_dl_classifier</code></span><span data-if="cpp" style="display:none"><code>ApplyDlClassifier</code></span><span data-if="com" style="display:none"><code>ApplyDlClassifier</code></span><span data-if="dotnet" style="display:none"><code>ApplyDlClassifier</code></span><span data-if="python" style="display:none"><code>apply_dl_classifier</code></span></code></a>.
</p>
</li>
</ul>

</dd>
</dl>
<h3>Data for Classification</h3>
<p>We distinguish between data used for training and data for inference.
Latter one consists of bare images. But for the former one you already
know to which class the images belong and provide this information over
the corresponding labels.
</p>
<p>The training data is used to train a classifier for your specific task.
With the aid of this data the classifier can learn which classes are to be
distinguished and how their representatives look like.
In classification, the image is classified as a whole.
Therefore, the training data consists of images and their ground truth
labels, thus the class you say this image belongs to.
Note that the images should be as representative as possible for your
task.
There are different possible ways, how to store and retrieve the ground
truth labels.
The procedure <code>read_dl_classifier_data_set</code> supports the following
sources of the ground truth label for an image:
</p>
<ul>
<li>
<p> The last directory name containing the image
</p>
</li>
<li>
<p> The file name.
</p>
</li>
</ul>
<p>For training a classifier, we use a technique called transfer learning
(see the chapter <a href="toc_deeplearning.html">Deep Learning</a>).
For this, you need less resources, but still a suitable set of data which
is generally in the order of hundreds to thousands per class. While
in general the network should be more reliable when trained on a larger
dataset, the amount of data needed for training also depends on the
complexity of the task.
You also want enough training data to split it into three subsets, which
are preferably independent and identically distributed, see the section
“Data” in the chapter <a href="toc_deeplearning.html">Deep Learning</a>.
</p>
<p>Regardless of the application,
the network poses requirements on the images regarding the image
dimensions, the gray value range, and the type.
The specific values depend on the network itself and can be queried with
<a href="get_dl_classifier_param.html"><code><span data-if="hdevelop" style="display:inline"><code>get_dl_classifier_param</code></span><span data-if="c" style="display:none"><code>get_dl_classifier_param</code></span><span data-if="cpp" style="display:none"><code>GetDlClassifierParam</code></span><span data-if="com" style="display:none"><code>GetDlClassifierParam</code></span><span data-if="dotnet" style="display:none"><code>GetDlClassifierParam</code></span><span data-if="python" style="display:none"><code>get_dl_classifier_param</code></span></code></a>.
You can find guidance on how to implement such a preprocessing stage
by the procedure <code>preprocess_dl_classifier_images</code>.
</p>
<hr>
<h4 id="section_list">算子列表</h4>
<dl>
<dt><a href="apply_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline;">apply_dl_classifier</span><span data-if="dotnet" style="display:none;">ApplyDlClassifier</span><span data-if="python" style="display:none;">apply_dl_classifier</span><span data-if="cpp" style="display:none;">ApplyDlClassifier</span><span data-if="c" style="display:none;">apply_dl_classifier</span></code></a></dt>
<dd>Infer the class affiliations for a set of images using a
deep-learning-based classifier.</dd>
</dl>
<dl>
<dt><a href="clear_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline;">clear_dl_classifier</span><span data-if="dotnet" style="display:none;">ClearDlClassifier</span><span data-if="python" style="display:none;">clear_dl_classifier</span><span data-if="cpp" style="display:none;">ClearDlClassifier</span><span data-if="c" style="display:none;">clear_dl_classifier</span></code></a></dt>
<dd>Clear a deep-learning-based classifier.</dd>
</dl>
<dl>
<dt><a href="clear_dl_classifier_result.html"><code><span data-if="hdevelop" style="display:inline;">clear_dl_classifier_result</span><span data-if="dotnet" style="display:none;">ClearDlClassifierResult</span><span data-if="python" style="display:none;">clear_dl_classifier_result</span><span data-if="cpp" style="display:none;">ClearDlClassifierResult</span><span data-if="c" style="display:none;">clear_dl_classifier_result</span></code></a></dt>
<dd>Clear a handle containing the results of the deep-learning-based
classification.</dd>
</dl>
<dl>
<dt><a href="clear_dl_classifier_train_result.html"><code><span data-if="hdevelop" style="display:inline;">clear_dl_classifier_train_result</span><span data-if="dotnet" style="display:none;">ClearDlClassifierTrainResult</span><span data-if="python" style="display:none;">clear_dl_classifier_train_result</span><span data-if="cpp" style="display:none;">ClearDlClassifierTrainResult</span><span data-if="c" style="display:none;">clear_dl_classifier_train_result</span></code></a></dt>
<dd>Clear the handle of a deep-learning-based classifier training result.</dd>
</dl>
<dl>
<dt><a href="deserialize_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline;">deserialize_dl_classifier</span><span data-if="dotnet" style="display:none;">DeserializeDlClassifier</span><span data-if="python" style="display:none;">deserialize_dl_classifier</span><span data-if="cpp" style="display:none;">DeserializeDlClassifier</span><span data-if="c" style="display:none;">deserialize_dl_classifier</span></code></a></dt>
<dd>Deserialize a deep-learning-based classifier.</dd>
</dl>
<dl>
<dt><a href="get_dl_classifier_param.html"><code><span data-if="hdevelop" style="display:inline;">get_dl_classifier_param</span><span data-if="dotnet" style="display:none;">GetDlClassifierParam</span><span data-if="python" style="display:none;">get_dl_classifier_param</span><span data-if="cpp" style="display:none;">GetDlClassifierParam</span><span data-if="c" style="display:none;">get_dl_classifier_param</span></code></a></dt>
<dd>Return the parameters of a deep-learning-based classifier.</dd>
</dl>
<dl>
<dt><a href="get_dl_classifier_result.html"><code><span data-if="hdevelop" style="display:inline;">get_dl_classifier_result</span><span data-if="dotnet" style="display:none;">GetDlClassifierResult</span><span data-if="python" style="display:none;">get_dl_classifier_result</span><span data-if="cpp" style="display:none;">GetDlClassifierResult</span><span data-if="c" style="display:none;">get_dl_classifier_result</span></code></a></dt>
<dd>Retrieve classification results inferred by a deep-learning-based
classifier.</dd>
</dl>
<dl>
<dt><a href="get_dl_classifier_train_result.html"><code><span data-if="hdevelop" style="display:inline;">get_dl_classifier_train_result</span><span data-if="dotnet" style="display:none;">GetDlClassifierTrainResult</span><span data-if="python" style="display:none;">get_dl_classifier_train_result</span><span data-if="cpp" style="display:none;">GetDlClassifierTrainResult</span><span data-if="c" style="display:none;">get_dl_classifier_train_result</span></code></a></dt>
<dd>Return the results for the single training step of a deep-learning-based
classifier.</dd>
</dl>
<dl>
<dt><a href="read_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline;">read_dl_classifier</span><span data-if="dotnet" style="display:none;">ReadDlClassifier</span><span data-if="python" style="display:none;">read_dl_classifier</span><span data-if="cpp" style="display:none;">ReadDlClassifier</span><span data-if="c" style="display:none;">read_dl_classifier</span></code></a></dt>
<dd>Read a deep-learning-based classifier from a file.</dd>
</dl>
<dl>
<dt><a href="serialize_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline;">serialize_dl_classifier</span><span data-if="dotnet" style="display:none;">SerializeDlClassifier</span><span data-if="python" style="display:none;">serialize_dl_classifier</span><span data-if="cpp" style="display:none;">SerializeDlClassifier</span><span data-if="c" style="display:none;">serialize_dl_classifier</span></code></a></dt>
<dd>Serialize a deep-learning-based classifier.</dd>
</dl>
<dl>
<dt><a href="set_dl_classifier_param.html"><code><span data-if="hdevelop" style="display:inline;">set_dl_classifier_param</span><span data-if="dotnet" style="display:none;">SetDlClassifierParam</span><span data-if="python" style="display:none;">set_dl_classifier_param</span><span data-if="cpp" style="display:none;">SetDlClassifierParam</span><span data-if="c" style="display:none;">set_dl_classifier_param</span></code></a></dt>
<dd>Set the parameters of a deep-learning-based classifier.</dd>
</dl>
<dl>
<dt><a href="train_dl_classifier_batch.html"><code><span data-if="hdevelop" style="display:inline;">train_dl_classifier_batch</span><span data-if="dotnet" style="display:none;">TrainDlClassifierBatch</span><span data-if="python" style="display:none;">train_dl_classifier_batch</span><span data-if="cpp" style="display:none;">TrainDlClassifierBatch</span><span data-if="c" style="display:none;">train_dl_classifier_batch</span></code></a></dt>
<dd>Perform a training step of a deep-learning-based classifier on a batch of
images.</dd>
</dl>
<dl>
<dt><a href="write_dl_classifier.html"><code><span data-if="hdevelop" style="display:inline;">write_dl_classifier</span><span data-if="dotnet" style="display:none;">WriteDlClassifier</span><span data-if="python" style="display:none;">write_dl_classifier</span><span data-if="cpp" style="display:none;">WriteDlClassifier</span><span data-if="c" style="display:none;">write_dl_classifier</span></code></a></dt>
<dd>Write a deep-learning-based classifier in a file.</dd>
</dl>
<!--OP_REF_FOOTER_START-->
<hr>
<div class="indexlink">
<a href="index_classes.html"><span data-if="dotnet" style="display:none;">类别</span><span data-if="cpp" style="display:none;">类别</span></a><span data-if="dotnet" style="display:none;"> | </span><span data-if="cpp" style="display:none;"> | </span><a href="index_by_name.html">算子列表</a>
</div>
<div class="footer">
<div class="copyright">HALCON算子参考手册 Copyright © 2015-2023 51Halcon</div>
</div>
</div>
</body>
</html>
